package com.example.demo.demos.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import springfox.documentation.annotations.ApiIgnore;

@ApiIgnore
@Controller
@RequestMapping(value = "/api")
public class SwaggerProxyController {

	@GetMapping("/doc.html")
	public String knife4jIndex() {
		return "forward:/doc.html";
	}

	@GetMapping("/swagger-ui.html")
	public String springfoxIndex() {
		return "forward:/swagger-ui.html";
	}

	@GetMapping("/swagger-resources/configuration/ui")
	public String ui() {
		return "forward:/swagger-resources/configuration/ui";
	}

	@GetMapping("/webjars/springfox-swagger-ui/{s:.+}")
	public String base(@PathVariable String s) {
		return "forward:/webjars/springfox-swagger-ui/" + s;
	}

	@GetMapping("/webjars/css/{s:.+}")
	public String css(@PathVariable String s) {
		return "forward:/webjars/css/" + s;
	}

	@GetMapping("/webjars/js/{s:.+}")
	public String js(@PathVariable String s) {
		return "forward:/webjars/js/" + s;
	}

	@GetMapping("/webjars/fonts/{s:.+}")
	public String knife4jFonts(@PathVariable String s) {
		return "forward:/webjars/fonts/" + s;
	}

	@GetMapping("/webjars/img/{s:.+}")
	public String img(@PathVariable String s) {
		return "forward:/webjars/img/" + s;
	}

	@GetMapping("/webjars/oauth/{s:.+}")
	public String oauth(@PathVariable String s) {
		return "forward:/webjars/oauth/" + s;
	}

	@GetMapping("/img/icons/{s:.+}")
	public String icons(@PathVariable String s) {
		return "forward:/img/icons/" + s;
	}

	@GetMapping("/webjars/springfox-swagger-ui/fonts/{s:.+}")
	public String fonts(@PathVariable String s) {
		return "forward:/webjars/springfox-swagger-ui/fonts/" + s;
	}

	@GetMapping("/swagger-resources")
	public String resources() {
		return "forward:/swagger-resources";
	}

	@GetMapping("/v2/api-docs")
	public String docs() {
		return "forward:/v2/api-docs";
	}

	@GetMapping("/swagger-resources/configuration/security")
	public String security() {
		return "forward:/swagger-resources/configuration/security";
	}
}
